﻿Namespace Classes
    Public Class SitePages
        Inherits System.Collections.CollectionBase

        Public Sub Add(ByVal SitePageToAdd As SitePage)
            Try
                List.Add(SitePageToAdd)
            Catch ex As Exception
                '
                'TODO: Error Handling
                '
                Throw ex
            End Try
        End Sub

        Public Sub Remove(ByVal IndexOfSitePageToRemove As Integer)
            Try
                If IndexOfSitePageToRemove > Count - 1 Or IndexOfSitePageToRemove < 0 Then
                    Throw New Exception("An invalid index was given for the SitePage to remove.")
                Else
                    List.RemoveAt(IndexOfSitePageToRemove)
                End If
            Catch ex As Exception
                '
                'TODO: Error Handling
                '
                Throw ex
            End Try
        End Sub

        Default Public ReadOnly Property Item(ByVal IndexOfSitePageToRetrieve As Integer) As SitePage
            Get
                Try
                    If IndexOfSitePageToRetrieve > Count - 1 Or IndexOfSitePageToRetrieve < 0 Then
                        Throw New Exception("An invalid index was given for the SitePage to retrieve.")
                    Else
                        Return CType(List.Item(IndexOfSitePageToRetrieve), SitePage)
                    End If
                Catch ex As Exception
                    '
                    'TODO: Error Handling
                    '
                    Throw ex
                End Try
            End Get
        End Property
    End Class
End Namespace


